package com.github.algorithm.tree;

/**
 * 每个节点有左节点, 右节点和父节点
 * @author Stephen
 * @date 2020/7/1 22:17
 */
public class TreeNode<T extends Comparable<T>> {
    private T value; //节点数据
    private TreeNode<T> left; //左节点
    private TreeNode<T> right; //右节点
    private TreeNode<T> parent; //父节点

    public T getValue() {
        return value;
    }

    public void setValue(T value) {
        this.value = value;
    }

    public TreeNode<T> getLeft() {
        return left;
    }

    public void setLeft(TreeNode<T> left) {
        this.left = left;
    }

    public TreeNode<T> getRight() {
        return right;
    }

    public void setRight(TreeNode<T> right) {
        this.right = right;
    }

    public TreeNode<T> getParent() {
        return parent;
    }

    public void setParent(TreeNode<T> parent) {
        this.parent = parent;
    }
}
